package com.lanzuo.pana.adapter.controller;

import com.lanzuo.pana.adapter.service.FileWatcherService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author <a href="eric_zheng@lanzuo.com.cn">eric</a>
 * @date 2025/06/25 18:46
 * @description
 */
@RestController
@Slf4j
@RequestMapping("/file/content")
public class FileContentController {

    @Resource
    FileWatcherService fileWatcherService;

    /**
     * 获取最新的文件内容
     *
     * @return
     */
    @GetMapping("/latest")
    public String lastest() {
        return fileWatcherService.readLatestTrustedContent().orElse("UNKNOWN");
    }


}
